#ifndef MY_EVENT_HANDLER_H
#define MY_EVENT_HANDLER_H

#include "../WinDraw/WinDraw.h"			//this includes the whole library. 
#include <stdio.h>	//for sprintf 

#include "MyScene.h"

/*/////////////////////////////////////////////////////////////////////////
 The EventHandler
--------------------------
 This class is used to receive two events from the system, namely: 
 - void OnRender(Bitmap* renderTarget) when the screen needs to be repainted. 
		* the "Bitmap" parameter represents a pointer to the screen surface and can be used 
			freely whenever a bitmap might be required. 
 - void OnInput(unsigned int Key, KeyStatus status)
		* "Key" is an integer representing a key (Windows' "Virtual Keycode", more with google). 
		* "status" is either "KeyPressed" or "KeyReleased". 
 An application must handle these events. 


 This EventHandler
 -------------------------
 This EventHandler does a few things: 
 - the constructor creates an image (of a tree), and an animation (an explosion). 
 - the destructor cleans up everything. 
 - OnInput writes the Key number and status of every pressed key in the Output Window of the Visual Studio. 
 - OnRender draws the tree, and moves/draws the animation on the screen. 
/////////////////////////////////////////////////////////////////////////*/

class MyEventHandler: public EventHandler	//base class defined in the WinDraw library. 
{
private: 
	Bitmap* explosion; 
	Animation* explosionAnim; 

	MyScene* scene;

	bool isExiting;
	bool paused;
	
	void CreateScene();
	void CreateAnimation(); //creates an animation. 

	void DrawScene(Bitmap* renderTarget);
	void DrawAnimation(Bitmap* renderTarget);

public: 
	MyEventHandler();
	~MyEventHandler();

	const bool isDying()	 const {return isExiting;			}
	const int  stageHeight() const {return scene->stageHeigth();}
	const int  stageWidth()  const {return scene->stageWidth(); }

	void OnRender(Bitmap* renderTarget);	//from base class. Renders the screen as needed. 
	void OnInput(unsigned int Key, KeyStatus status); //from base class. Receives the input. 
	void OnMouseInput(int MousePosX, int MousePosY, MouseKey key, KeyStatus status);
}; 

#endif